<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

<ui:composition template="template.xhtml">	
	<ui:define name="title">Mensagens recebidas</ui:define>

	<ui:define name="content">
	    	<!--  start page-heading -->
	<div id="page-heading">
		<h1>Mensagens recebidas</h1>
	</div>
	<!-- end page-heading -->

	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
	<tr>
		<th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td>
		<!--  start content-table-inner ...................................................................... START -->
		<div id="content-table-inner">		
			<!--  start table-content  -->
			<div id="table-content">
			
				<h:messages globalOnly="false" layout="table" showDetail="true" errorClass="red-left" dir="ltr" infoClass="green-left" styleClass="tbl_mensagem_retorno"></h:messages>
								
				<!--  start product-table -->
				<h:dataTable var="msg" border="0" width="100%" cellpadding="0" cellspacing="0" styleClass="product-table" rowClasses="normal, alternate-row" value="#{mensagemControl.listaMensagensRecebidas}" id="tbl_listagem" rendered="#{!empty mensagemControl.listaMensagensRecebidas}">
					<h:column headerClass="table-header-repeat line-left"><f:facet name="header" ><a href="">Id</a></f:facet>#{msg.idMensagem}</h:column>					
					<h:column headerClass="table-header-repeat line-left"><f:facet name="header" ><a href="">Tipo</a></f:facet>#{msg.tipoMensagem.tipoMensagem}</h:column>
					<h:column headerClass="table-header-repeat line-left"><f:facet name="header" ><a href="">Titulo</a></f:facet>#{msg.tituloMensagem}</h:column>
					
					<h:column headerClass="table-header-repeat line-left"><f:facet name="header"><a href="">Status</a></f:facet>
						<h:form>
						<h:graphicImage value="images/shared/yellow-ball.gif" width="26" height="26" title="Mensagem Não Lida" rendered="#{msg.cdStatus == 1}">
							<a4j:ajax event="click"></a4j:ajax>
						</h:graphicImage>	
						<h:graphicImage value="images/shared/green-ball.gif" width="26" height="26" title="Mensagem Lida" rendered="#{msg.cdStatus == 2}">
							<a4j:ajax event="click"></a4j:ajax>
						</h:graphicImage>	
						<h:graphicImage value="images/shared/blue-ball.gif" width="30" height="29" title="Mensagem Arquivada" rendered="#{msg.cdStatus == 3}">
							<a4j:ajax event="click" render="altera_status"></a4j:ajax>
						</h:graphicImage>
							<h:selectOneMenu value="#{msg.cdStatus}" valueChangeListener="#{mensagemControl.MudarStatusMensagem}" id="altera_status">
								<f:selectItems value="#{listas.listaStatusMensagemSelect}"></f:selectItems>
								<a4j:ajax event="change" render="@form"></a4j:ajax>
								<f:param name="idMensagem" value="#{msg.idMensagem}"></f:param>																															
							</h:selectOneMenu>										
						</h:form>						
					</h:column>
					
					<h:column headerClass="table-header-repeat line-left"><f:facet name="header" ><a href="">Destinatário</a></f:facet>#{msg.destinatario.nome}</h:column>
					<h:column headerClass="table-header-repeat line-left"><f:facet name="header" ><a href="">Data Emissão</a></f:facet><h:outputText value="#{msg.dataEmissao}"><f:convertDateTime pattern="dd/MM/yyyy"/></h:outputText></h:column>
					<h:column headerClass="table-header-repeat line-left">
						<f:facet name="header"><a href="">Ações</a></f:facet>
						<h:form>         					
							<h:commandLink styleClass="icon-1 info-tooltip" id="deletarMensagem" title="Vizualizar" action="#{mensagemControl.VizualizarMensagemRecebida}" >
            					<f:param  id="deletmensagem" name="idmensagem" value="#{msg.idMensagem}"/>  
         					</h:commandLink>
         					<h:commandLink styleClass="icon-2 info-tooltip"
								id="inativarMensagem"
								onclick="if (!confirm('Realmente deseja Inativar esse registro ?')) return false"
								title="Inativar" action="#{mensagemControl.InativarMensagemRecebida}">
							<f:param id="idmsgdelet" name="idmensagem"
								value="#{msg.idMensagem}" />								
							</h:commandLink>
						</h:form>
						
					</h:column>														
				</h:dataTable>
			</div>
			<!--  end content-table  -->		
			<!--  start actions-box  -->
			<div id="actions-box">
				<a href="" class="action-slider"></a>
				<div id="actions-box-slider">
					<a href="mantermensagem_edit.xhtml" class="action-edit">Nova Mensagem</a>					
				</div>
				<div class="clear"></div>
			</div>
			<!-- end actions-box........... -->
			
			<div class="clear"></div>
		 
		</div>
		<!--  end content-table-inner ............................................END  -->
		</td>
		<td id="tbl-border-right"></td>
	</tr>
	<tr>
		<th class="sized bottomleft"></th>
		<td id="tbl-border-bottom">&nbsp;</td>
		<th class="sized bottomright"></th>
	</tr>
	</table>
	<div class="clear">&nbsp;</div>
	</ui:define>
</ui:composition>
</html>